from django.db import models

class LoginUser(models.Model):
    id = models.AutoField(primary_key=True, verbose_name="序号")
    username = models.CharField(max_length=255, verbose_name='用户名')
    password = models.CharField(max_length=255, verbose_name='密码')
    email = models.EmailField(max_length=255, verbose_name='邮箱', unique=True)

    def __str__(self):
        return self.username

    class Meta:
        db_table = 'login_user'
        verbose_name = '登录用户'
        verbose_name_plural = '登录用户管理'

class articles(models.Model):
    id = models.IntegerField(primary_key=True, verbose_name="序号")
    name = models.CharField(max_length=255, verbose_name='名称')
    code = models.CharField(max_length=255, verbose_name='编号')
    status = models.CharField(max_length=255, verbose_name='状态')
    number = models.IntegerField(verbose_name='数量')

    def __str__(self):
        return f'{self.name} ({self.code})'

    class Meta:
        db_table = 'article_list'
        verbose_name = '文章列表'
        verbose_name_plural = '文章列表管理'

class Order(models.Model):
    id = models.IntegerField(primary_key=True, verbose_name="序号")
    name = models.CharField(max_length=255, verbose_name='名称')
    code = models.CharField(max_length=255, verbose_name='编号')
    lecturer = models.CharField(max_length=255, verbose_name='讲师')

    def __str__(self):
        return f'{self.name} ({self.code})'

    class Meta:
        db_table = 'order_list'
        verbose_name = '订单列表'
        verbose_name_plural = '订单列表管理'

class User(models.Model):
    id = models.IntegerField(primary_key=True, verbose_name="序号")
    name = models.CharField(max_length=255, verbose_name='姓名')
    sex = models.IntegerField(verbose_name='性别')
    age = models.IntegerField(verbose_name='年龄')
    nickname = models.CharField(max_length=255, verbose_name='昵称')
    mobile = models.CharField(max_length=255, verbose_name='手机号')
    stateName = models.CharField(max_length=255, verbose_name='状态')
    courseOrder = models.IntegerField(verbose_name='课程订单')
    courseNum = models.IntegerField(verbose_name='课程数量')
    address = models.CharField(max_length=255, verbose_name='地址')

    def __str__(self):
        return f'{self.name} ({self.nickname})'

    class Meta:
        db_table = 'user_list'
        verbose_name = '用户列表'
        verbose_name_plural = '用户列表管理'
